= include_stylesheet 'time_line'

#project-detail-menu
  .container
    .row.project-name.px-6
      %figure.d-flex.flex-align-center
        .img-container.thumbnail.px-0.py-0.no-border
          - if project.img.equal? nil
            %img{:src=>"icons/kcoin-project-list-icon.png",:style=>"background: #f3f3f3;"}
            %div.kcoin-figure-title-letter-div.pos-absolute
              %div.kcoin-figure-title-letter-span
                %p.mx-0
                  =project.first_word
          - else
            %img{:src=>"#{project.img}",:style=>"background: #f3f3f3;"}
      %span
        =project.name
    .row.tab-menu
      %ul{"data-role"=>"tabs", "data-expand"=>"true"}
        %li
          %a{:href=>"#_target_info"}
            = t('project_account_information')
        %li
          %a{:href=>"#_target_time_line"}
            = t('project_project_dynamics')
        %li
          %a{:href=>"#_target_members"}
            = t('project_member_list')
        %li
          %a{:href=>"#_target_settings"}
            = t('project_project_settings')

.container.bd-default.px-0.project-detail-container
  %input#repo_name{:type=>"hidden",:value=>"#{project.name}"}
  %input#repo_owner{:type=>"hidden",:value=>"#{project.owner}"}
  %input#repo_id{:type=>"hidden",:value=>"#{project.id}"}
  #_target_info
    .row.project-detail
      .cell-fs-12.cell-md-6.mx-auto
        .card
          .card-header.px-6
            .row
              .cell.text-left.left-title.left-title.d-flex.flex-align-center
                %span
                  = t('KCoin_total')
              .cell.text-right.right-title
                %span
                  =kcoin_history['TotalBalance']
          .card-content.px-6.pb-4
            .content-title.text-center.py-1
              %span
                = t('Issue_record')
            - kcoin_history['History'].each_with_index do |item, index|
              -if index >= 5
                -break
              .row.py-1
                .cell.text-left.content-item
                  %span
                    = item[:EventName]
                .stub.text-right.content-item-num
                  %span
                    = item[:ChangeNum]
            .row
              .cell.text-right.koin-card-link
                %a{:href=>"/project/history?uId=#{kcoin_history[:uId]}"}
                  = t('see_more_result') + '>'
      .cell-fs-12.cell-md-6.mx-auto
        .card
          .card-header.px-6
            .row
              .cell.text-left.left-title.left-title.d-flex.flex-align-center
                %span
                  = t('Token_total')
              .cell.text-right.right-title
                %span
                  =token_history['TotalBalance']
          .card-content.px-6.pb-4
            .content-title.text-center.py-1
              %span
                = t('Issue_record')
            - token_history['History'].each_with_index do |item, index|
              -if index >= 5
                -break
              .row.py-1
                .cell.text-left.content-item
                  %span
                    = item[:EventName]
                .stub.text-right.content-item-num
                  %span
                    = item[:ChangeNum]
            .row
              .cell.text-right.koin-card-link
                %a{:href=>"/project/history?pId=#{token_history[:pId]}&uId=#{token_history[:uId]}"}
                  = t('see_more_result') + ' >'
      .cell-fs-12.cell-md-6.mx-auto
        .card.chart#kcoin-chart
      .cell-fs-12.cell-md-6.mx-auto
        .card.chart#token-chart
  #_target_time_line
    .history.mr-4.ml-4-md.ml-0-fs
      .history-date
        %ul.mx-0.my-0
          %h2.first.d-flex.flex-align-center
            %span 2012
          %li.green.d-flex.flex-align-center
            %h3.no-visible-fs.visible-md 08.08
            %dl.mt-7-fs.mt-0-md
              %h3.visible-fs.no-visible-md.pos-relative 08.08
              %dt
                %span 贡献规则发生变更：每次提交可以获得100 token
          %li.green.d-flex.flex-align-center
            %h3.no-visible-fs.visible-md 05.08
            %dl.mt-7-fs.mt-0-md
              %h3.visible-fs.no-visible-md.pos-relative 05.08
              %dt
                %span 贡献规则发生变更：每次提交可以获得100 token
          %li.green.d-flex.flex-align-center
            %h3.no-visible-fs.visible-md 02.08
            %dl.mt-7-fs.mt-0-md
              %h3.visible-fs.no-visible-md.pos-relative 02.08
              %dt
                %span 贡献规则发生变更：每次提交可以获得100 token
      .history-date
        %ul.mx-0.my-0
          %h2.first.d-flex.flex-align-center
            %span 2010
          %li.green.d-flex.flex-align-center
            %h3.no-visible-fs.visible-md 11.24
            %dl.mt-7-fs.mt-0-md
              %h3.visible-fs.no-visible-md.pos-relative 11.24
              %dt
                %p 贡献规则发生变更：每次提交可以获得100 token
                %p 更长的文字的样式
                %p 可能又多段，填充文案填充文案
      .end.my-0
        %span 项目创建

  #_target_members
    #listContainer
    #listTemplate
      %ul#lists{"data-role"=>"list",
      "data-cls-list"=>"unstyled-list row d-flex mt-4 mx-0",
      "data-cls-list-item"=>"cell-sm-6 cell-md-4",
      "data-items"=>"9",
      "data-show-pagination"=>"true",
      "data-activity-type"=>"square",
      "data-cls-pagination"=>"flex-justify-center",
      "data-pagination-prev-title"=>"<",
      "data-pagination-next-title"=>">"}
        - collaborators.each do |item|
          %li.d-flex.flex-align-center.py-5
            .member-img.d-inline-block
              %img{:src=>"#{item["avatar_url"]}"}
            .member-msg.d-inline-block.pl-4
              .row
                .cell.member-name
                  %span
                    = item["login"]
                  .row
                    .cell-12-fs.cell-6-sm.pl-3
                      %span 贡献度：
                      = item["contributions"]
                    .cell-12-fs.cell-6-sm.pl-3
                      %span 收益：
                      = item["balance"]

  #_target_settings
    %form#form{:onsubmit=>"return false;",
    :enctype=>"multipart/form-data"}
      .row.mx-0
        .cell-12.form-group.px-3-fs.px-0-sm
          %label
            = '1. ' + t('project_detail_name')
          %input#project_name{:type=>"text",
              :name=>"custom_name",
              maxlength: 120,
              "value"=>"#{project.custom_name ||= project.name}",
              "data-validate" => "required"}
          %span.invalid_feedback
            = t('project_detail_name_validate')
          %input#github_project_id{:type=>"hidden",
              :name=>"github_project_id",
              :value=>"#{project.github_project_id}"}
        .cell-12.form-group.px-3-fs.px-0-sm
          %label
            = '2. ' + t('project_detail_img')
          %input#img{:type=>"file",
            "data-role"=>"file",
            :name=>"images",
            "data-button-title"=>"#{t('chose_files')}",
            "dir"=>"rtl",
            "data-validate"=>"custom=validateFileSize"}
      .row.mx-0
        .cell-12.text-left.mt-20.px-3-fs.px-0-sm
          %button#btn_submit.button.info.kcoin-button-normal
            = t('project_detail_btn_save')

%script{:src=>'javascripts/echarts.min.js'}
%script{:src=>'javascripts/macarons.js'}

= include_javascript 'project_detail'
